package com.qf.controller;

import com.qf.pojo.Goods;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @version v1.0.0
 * @Description:
 * @author: 姜红凯
 * @date: 2022.03.14
 * @since 1.0
 */
@RestController
public class GoodsController {

    @Value("${server.port}")
    private Integer port;

    @RequestMapping("/query/{id}")
    public String query(@PathVariable("id") Integer id) {
        System.out.println(1/id);
        return "查询商品信息!--" + port + "::::" + Math.random();
    }


    @RequestMapping("/findById")
    public String findById(Integer id) {
        System.out.println("id:" + id);
        return "根据id查询商品信息!--" + id;
    }
    @RequestMapping("/{id}")
    public String findDetails(@PathVariable("id") Integer id) {
        System.out.println("id:" + id);
        return "根据id查询商品信息!--" + id;
    }
    @PostMapping("/save")
    public String save(@RequestBody Goods goods) {
        System.out.println("goods:" + goods);
        return "根据id查询商品信息!--" + goods;
    }

}
